Objects Reference

class directX

Definition

class directX
{
  public:
  int mpmode;
  int nplayers;
  player_data players[FLYMP_MAXPLAYERS];
  unsigned char diks[256];
  DIMOUSESTATE dims;

  directX(HWND hWnd,HINSTANCE hInst)
  { memset(this,0,sizeof(directX)); Init(hWnd,hInst); };

  void get_input();
  int load_wav_file(LONG cchBuffer,HPSTR pchBuffer,LPDIRECTSOUNDBUFFER *buf,LPDIRECTSOUND3DBUFFER *buf3d);
  void set_listener(float *pos,float *vel,float *Y,float *Z);
  LPDIRECTSOUNDBUFFER clone_sound(LPDIRECTSOUNDBUFFER buf);
  void set_master_volume(int volume);
  int init_multiplayer(char *netaddress=0);
  void free_multiplayer();
  mp_games *enum_games(LPGUID app_guid);
  int join_game(LPGUID game_guid,char *player_name);
  int create_game(LPGUID app_guid,char *game_name);
  char *get_player_address(DWORD dpid);
  void send_message(mp_msg *msg,int len,DWORD dpid=0);
  int get_num_messages();
  mp_msg *get_message(DWORD *size);
  int add_player(char *name,DWORD dpid,void *data);
  void *remove_player(int i);

  ~directX()
  { Release(); };
};

Data Members

Member Type Description
mpmode int current multiplayer mode. one of the following enumerated types:
FLYMP_NOMP - no multiplayer
FLYMP_CLIENT - running as client
FLYMP_SERVER - running as server
nplayers int number of players in a multiplayer game
players player_data[] player data array
diks unsigned char[] direct input keys array
dims DIMOUSESTATE direct input mouse state

Methods

get_input, load_wav_file, set_listener, clone_sound, set_master_volume, init_multiplayer, free_multiplayer, enum_games, join_game, create_game, get_player_address, send_message, get_num_messages, get_message, add_player, remove_player

Remarks

This class implements an interface with DirectX for input, sound and multiplayer. 
A global variable named directx is the main interface with this class and must be initialized/freed with the init_directx and close_directx global functions.

See Also

Global Variables, Global Functions, mp_games, mp_msg